﻿using Puerts;
using Puerts.Editor.Generator;
using System;
using System.Reflection;

namespace purets_gen
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //string cmd = null;
            //固定生成，别折腾
            string dll = null;
            string outputpath = null;
            try
            {
                //cmd = args[0].ToLower();
                dll = args[0].ToLower();
                if (args.Length > 1)
                {
                    outputpath = args[1];
                    Configure.outputdir = outputpath;
                }
                else
                {
                    outputpath = System.IO.Path.GetFullPath(Directory.GetCurrentDirectory()) + "/Gen/";
                }
                Console.WriteLine("dll=" + dll);
                Console.WriteLine("outputpath=" + outputpath);
            }
            catch
            {
                Console.WriteLine("use purets_gen   [dll]  [outputpath]   for Generate code");
                Console.WriteLine("use purets_gen   [dll]  for Generate code to currect folder");
            }
            Assembly export = Assembly.LoadFile(System.IO.Path.GetFullPath(dll));

            Console.WriteLine("Generate Code");
            UnityMenu.GenerateCode(export);
            return;



        }


    }
}